import { log } from 'console';
import request from '/@/utils/request';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 登录api接口集合
 * @method signIn 用户登录
 * @method signOut 用户退出登录
 */
// export function useLoginApi() {
// 	return {
// 		signIn: (data: object) => {
// 			return request({
// 				url: '/user/signIn',
// 				method: 'post',
// 				data,
// 			});
// 		},
// 		signOut: (data: object) => {
// 			return request({
// 				url: '/user/signOut',
// 				method: 'post',
// 				data,
// 			});
// 		},
// 	};
// }
// 登录接口
export const login = (data?: object) => {
	return request({
		url: '/auth/admin/login',
		method: 'post',
		data,
	});
}
// 员工列表请求
export const userList = () => {
	return request({
		url: '/user/index/index',
		method: 'post',
	});
}

// 公司列表请求
export const companyList = () => {
	return request({
		url: '/organization/index/index',
		method: 'post',
	});
}

// 档级列表请求
export const GradeList = () => {
	return request({
		url: '/grade/index/index',
		method: 'post',
	});
}

// 证书列表请求
export const certclassList = () => {
	return request({
		url: '/user/certclass/index',
		method: 'post',
	});
}

// 项目列表请求
export const ItemList = () => {
	return request({
		url: '/organization/project/index',
		method: 'post',
	});
}

// 员工添加请求请求
export const staffAdd = (data: any) => {
	return request({
		url: '/user/index/add',
		method: 'post',
		data: data,
	});
}
// 员工编辑请求
export const staffEdit = (data: any) => {
	return request({
		url: '/user/index/edit',
		method: 'post',
		data: data,
	});
}

// 员工删除请求
export const deleteData = (data: any) => {
	return request({
		url: '/user/index/del',
		method: 'post',
		data: { id: data },
	});
}

// 账号管理请求
export const accountList = () => {
	return request({
		url: '/auth/admin/index',
		method: 'post',
	});
}

// 图片上传请求
export const imgFile = (formData: FormData) => {
	return request({
		url: '/api/common/upload',
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data' // 必须设置这个请求头
		}
	});
}

// 账号管理请求
export const accountAdd = (data: any) => {
	return request({
		url: '/auth/admin/add',
		method: 'post',
		data: data,
	});
}

// 账号删除请求
export const accountDel = (data: any) => {
	return request({
		url: '/auth/admin/del',
		method: 'post',
		data: data,
	});
}

// 菜单列表请求
export const menuList = () => {
	return request({
		url: '/auth/menus/index',
		method: 'post',
	});
}

// 菜单添加请求
export const menuAdd = (data: any) => {
	return request({
		url: '/auth/menus/add',
		method: 'post',
		data: data
	});
}

// 菜单删除请求
export const menuDel = (data: any) => {
	return request({
		url: '/auth/menus/del',
		method: 'post',
		data: data
	});
}

// 角色列表请求
export const roleList = () => {
	return request({
		url: '/auth/roles/index',
		method: 'post',
	});
}

// 角色添加请求
export const roleAdd = (data: any) => {
	return request({
		url: '/auth/roles/add',
		method: 'post',
		data: data,
	});
}

// 角色添加请求
export const roleDel = (data: any) => {
	return request({
		url: '/auth/roles/del',
		method: 'post',
		data: data,
	});
}

// 项目列表请求
export const itemList = (data: any) => {
	return request({
		url: '/organization/project/index',
		method: 'post',
		data: data,
	});
}

// 项目添加请求
export const itemAdd = (data: any) => {
	return request({
		url: '/organization/project/add',
		method: 'post',
		data: data,
	});
}

// 项目添加请求
export const itemEdit = (data: any) => {
	return request({
		url: '/organization/project/edit',
		method: 'post',
		data: data,
	});
}

// 项目下架请求
export const itemshelves = (data: any) => {
	return request({
		url: '/organization/project/del',
		method: 'post',
		data: data,
	});
}


// 项目恢复请求
export const itemRenew = (data: any) => {
	return request({
		url: '/organization/project/back',
		method: 'post',
		data: data,
	});
}